package com.cross.core;

/**
 * 写入器
 * 
 * 2009-5-11
 * 
 * @author craziness_stone
 */
public abstract class AbstractWriter implements Writer {
	// 当前行
	protected Row currentRow;
	// 总行数
	protected long totalRow;
	// 当前行号
	protected long currentRowIndex;
	// 表头对象
	protected Header header;

	/**
	 * 是否可写入
	 * 
	 * 
	 * 2009-5-11
	 * 
	 * @author craziness_stone
	 * @return
	 */
	@Override
	public boolean available() {
		return true;
	}

	/**
	 * 写入一行
	 * 
	 * 
	 * 2009-5-11
	 * 
	 * @author craziness_stone
	 * @param row
	 * @return
	 */
	@Override
	public Row write(Row row) {
		currentRow = row;
		writeRow();
		return row;
	}

	/**
	 * 写入一行
	 * 
	 * 2009-5-11
	 * 
	 * @author craziness_stone 
	 */
	protected abstract void writeRow();

	/**
	 * 设置表头对象
	 * 
	 *
	 * 2009-5-11 
	 * @author craziness_stone
	 * @param header
	 */
	public void setHeader(Header header) {
		this.header = header;
	}

}
